Open
Conversation
added 8 commits
August 31, 2011 13:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ok, I added support for selector containment, easily used like the following. You can see it illustrated in the default example of my fork. The cat box is bordered by 1px solid red.
move('#cat')
.add('left', Math.random() * 30 | 0)
.add('top', Math.random() * 30 | 0)
.contain('#cat_box')
.end()
I also added converse property translation. The converse translation works when I do something like the following:
move('#cat')
.add('left', Math.random() * 30 | 0)
.add('top', Math.random() * 30 | 0)
.contain({
bottom : '+30-50'
})
.end();
Basically, it'll convert the bottom containment to the appropriate top, since that's the prop that's set in the Move object. In this case, you would be contained to the 'top' equivalent of 30 to 50 px from the bottom.
This code might need some cleaning up, and I'm totally open to suggestions.